<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
            <h4 class="modal-title">设置 {$data.arc_name}.{$data.arc_type} 的标签</h4>
        </div>
        <div class="modal-body">
            <div class="portlet-body">
                <div class="navbar navbar-default" role="navigation">
                    <div class="collapse navbar-collapse navbar-ex1-collapse tags_show" >

                    </div>
                </div>
                <div class="btn-pane" id="tab">
                    <div class="portlet-body">
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-advance table-hover">
                                <thead>
                                <tr>
                                    <th>
                                        <i class="fa fa-tags"></i> 标签组
                                    </th>
                                    <th class="hidden-xs">
                                        <i class="fa fa-tag"></i> 一级标签
                                    </th>
                                    <th>
                                        <i class="fa fa-tag"></i> 二级标签
                                    </th>
                                    <th>
                                    </th>
                                </tr>
                                </thead>
                                <tbody class="tbody" style="text-align: center">

                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn default model1close" data-dismiss="modal">关闭</button>
            <!--<button type="button" class="btn blue save">保存</button>-->
        </div>
    </div>
</div>
<script>
    dt().modalSave();
    $(function () {
        getTagTree();
        getTags();
    });
    function getTagTree() {
        var id = '{$data.arc_id}';
        $.ajax({
            url:'{:url("index/Prearc/getTagsTree1")}',
            type:'post',
            data:{id:id},
            dataType:'json',
            success:function (e) {
                if(e.code == 1){
                    $('.tbody').html(e.data);
                }
                $('.editBtn').click(function () {
                    var tid = $(this).attr('data-id');
                    $.ajax({
                        url:'{:url("index/Prearc/setTagData")}',
                        type:'post',
                        data:{id:id,tid:tid},
                        dataType:'json',
                        success:function (e) {
                            getTags();
                        }
                    });

                    return false;
                });

            }
        });
    }
    function getTags() {
        var id = '{$data.arc_id}';
        $.ajax({
            url:'{:url("index/Prearc/getTagsData")}',
            type:'post',
            data:{id:id},
            dataType:'json',
            success:function (e) {
                if(e.code == 1){
                    $('.tags_show').html(e.data);
                }
                $('.delTagBtn').click(function () {
                    var rid = $(this).attr('data-id');
                    $.ajax({
                        url:'{:url("index/Prearc/delTagData")}',
                        type:'post',
                        data:{id:rid},
                        dataType:'json',
                        success:function (e) {
                            getTags();
                        }
                    });

                    return false;
                });

            }
        });
    }
</script>